void main(List<String> args) {
  // 需求：计算购物车数据中，被勾选商品的总价
  // 准备购物车数据
  List carts = [
    {'count': 2, 'price': 10.0, 'selected': true},
    {'count': 1, 'price': 30.0, 'selected': false},
    {'count': 5, 'price': 20.0, 'selected': true},
  ];

  // 声明总金额
  double totalAmount = 0;
  for (var item in carts) {
    if (item['selected']) {
      totalAmount += item['count'] * item['price'];
    }
  }
  print(totalAmount);
}
